package com.cashmanager.client.view;

import com.cashmanager.client.view.base.BaseVPage;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;

public class TracePage extends BaseVPage{
	protected ListGrid listGrid = new ListGrid();
	public TracePage(){
		listGrid.setWidth100();
		listGrid.setHeight100();
		listGrid.setAutoFetchData(true);
//		listGrid.setDataSource(new WarnDataSource());
		listGrid.setShowFilterEditor(true);  
		listGrid.setFilterOnKeypress(true);
		VLayout hl = new VLayout();
		DynamicForm base = new DynamicForm();
		TextItem d1 = new TextItem("起始日期");
		d1.setValue("2012-05-01");
		TextItem d2 = new TextItem("终止日期");
		d2.setValue("2012-06-01");

//	    base.setIsGroup(true);  
//	    base.setGroupTitle("查询");
//	    base.setHeight("10%");  		    
	    base.setWidth("100%");  
	    base.setNumCols(6);
	    base.setFields(d1,d2);			
	    hl.addMember(base);
	    hl.setHeight(30);
	    HLayout btnLayout = new HLayout();
	    btnLayout.setWidth100();
	    btnLayout.setHeight(20);
	    btnLayout.setMargin(2);
	    btnLayout.setAlign(Alignment.RIGHT);
	    IButton search = new IButton("查询");
	    btnLayout.addMember(search);
	    addMember(hl);
		addMember(btnLayout);
	    addMember(listGrid);
	}
	
	protected void setDataSource(DataSource ds){
		listGrid.setDataSource(ds);
	}
	
}
